package com.eamois.dao.graph.impl;

import java.sql.SQLException;
import java.util.Collection;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.eamois.dao.graph.GraphContentDao;
import com.eamois.dao.graph.GraphLabelCellDao;
import com.eamois.dao.impl.BaseDaoImpl;
import com.eamois.domain.graph.GraphContent;
import com.eamois.domain.graph.GraphLabelCell;
import com.eamois.domain.graph.GraphLine;
import com.eamois.domain.graph.GraphTemplate;
import com.mit.plm.sql.documentManage.SqlMix;

public class GraphLabelCellDaoImpl extends BaseDaoImpl<GraphLabelCell> implements
		GraphLabelCellDao {

	

	@SuppressWarnings("unchecked")
	@Override
	public Collection<GraphLabelCell> findGraphLabelCellByTemplate(
			final GraphTemplate graphTemplate) {
		return (Collection<GraphLabelCell>) this.getHibernateTemplate().execute(new HibernateCallback() {
			@Override
			public Object doInHibernate(Session arg0)
					throws HibernateException, SQLException {
				// TODO Auto-generated method stub
				Criteria criteria = arg0.createCriteria(GraphLabelCell.class);
				criteria.add(Restrictions.eq("graphTemplate", graphTemplate));
				return criteria.list();
			}
		});
	}

	
}
